﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Excell_On_Services.Models.OrderService>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	DetailsClient
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="content" >
	<div class="content_bg" >
        <div class="content_bg_bott" style="min-height: 400px;">
            <h1>List Details Order Services</h1>
   
     <table cellpadding=10" width="98%" class="view_history_order" border="0">
        <thead>
            <tr>
                <th>S.No</th>
                <th>
                    OrderID
                </th>
                <th>
                    ServiceID
                </th>
                <th>
                    Price
                </th>
                <th>
                    Quantity
                </th>
                <th>
                    Date Start Service
                </th>
                <th>
                    Date End Service
                </th>
                <th>
                    Amout money
                </th>
            </tr>
        </thead>
        <% decimal totalMoney = 0; %>
        
        <%int i = 1; %>
    <% 
        foreach (var item in Model.OrderDetails) {
            string name_class = "";
            if (i % 2 == 1) name_class = "att_row";
     %>
    
        <tr class="<%= name_class %>">
            <td>
                <b><%= i++ %></b>
            </td>
            <td>
                <%: item.OrderID %>
            </td>
            <td>
                <%: item.Service.Name %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Price) %>
            </td>
            <td style="text-align: center;">
                <%: item.Quantity %>
            </td>
            <td>
                <%: item.StartDate %>
            </td>
            <td>
                <%: item.EndDate %>
            </td>
            <td style="text-align: right;font-weight:bold; font-size:14px;">
                <%: (item.Quantity * item.Price * (long)((TimeSpan)(item.EndDate - item.StartDate)).TotalDays).ToString("c")%>
            </td>
            <td style='display:none;'>
            <%: totalMoney += item.Quantity * item.Price * (long)((TimeSpan)(item.EndDate - item.StartDate)).TotalDays %>
            </td>
            
        </tr>
    
    <% } %>
    <tr >
        <td colspan ="7" style="text-align: right;">
            <p style="font-weight:bold; font-size:14px;"><b>Total money :</b></p>
        </td>
        <td style="text-align: right;font-weight:bold; font-size:14px;"><b><% = totalMoney.ToString("c") %></b></td>
    </tr>
    </table>

    
    <h1>List payment Date</b></h1>
    
     <% i = 1; %>
    <table cellpadding=10" width="98%" class="view_history_order" border="0">
        <thead>
            <tr>
                <th>S.No</th>
                <th>
                    PayemntID
                </th>
                <th>
                    OrderID
                </th>
                <th>
                    Payment
                </th>
                <th>
                    Duration Date
                </th>
                <th>
                    Date paid
                </th>
            </tr>
          </thead>
          
          <% foreach (var item in Model.OrderPayments){
             string durationType    = "";
             string name_class      = "";
             if (i % 2 == 1) name_class = "att_row";
                 
             if (item.DurationDate < DateTime.Now && item.DatePaid == null){
                   durationType = " trDuration";
              }
            %>
               
             <tr class = "<%=durationType %> <%=name_class %>">
                <td>
                    <b><%= i++ %></b>
                </td>
                 <td>
                    <%: item.PaymentID %>
                 </td>
                 <td>
                    <%:item.OrderID %>
                 </td>
                 <td>
                    <%:((decimal)item.Payment).ToString("c") %>
                 </td>
                 <td>
                    <%:item.DurationDate %>
                 </td>
                 <td>
                    <%:item.DatePaid%>
                 </td>
             </tr>
          <% } %>
    </table>
</div>
</div>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent1" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MainContent2" runat="server">
</asp:Content>
